#ifndef TUNNEL_H
#define TUNNEL_H

#include "Demo.h"
#include "VectorBatch.h"
#include "Mesh.h"
#include "Camera.h"

using namespace Cvekas;

class Tunnel : public TimelineSegment
{
public:
	Tunnel(RendererPtr renderer, VectorBatchPtr vector_batch);
	virtual ~Tunnel();

	virtual void init(boost::weak_ptr<Demo> owner);
	virtual void close();
	
	virtual void update(float t);
	virtual void render(float t);

private:
	static const uint trail_length = 38;

	RendererPtr renderer;
	RenderableMeshPtr tunnel;
	RenderableMeshPtr light1[trail_length];
	RenderableMeshPtr light2[trail_length];
	RenderableMeshPtr light3[trail_length];

	Vector3 light_pos[3];
	Vector3 light_attenuations;

	SimpleCamera camera;

	VectorBatchPtr vector_batch;

	std::vector<Vector2> fullscreen_rect;
};

typedef boost::shared_ptr<Tunnel> TunnelPtr;

#endif